/*************************************************************************
	> File Name: EP20.cpp
	> Author: 
	> Mail: 
	> Created Time: 三  8/14 16:42:37 2019
 ************************************************************************/

#include <iostream>
#include <map>
#include <vector>
using namespace std;

struct BigInt{
    BigInt(int x) {
        num.push_back(x);
        proccess_digit();
    }
    BigInt operator*(int x) {
        BigInt c(*this);
        for (int i = 0; i < c.num.size(); i++) {
            c.num[i] *= x;
        }
        c.proccess_digit();
        return c;
    }
    void proccess_digit() {
        for (int i = 0; i < num.size(); i++) {
            if (num[i] < 10) continue;
            if (i + 1 == num.size()) num.push_back(0);
            num[i + 1] += num[i] / 10;
            num[i] %= 10;
        }
        while (num.size() > 1 && num[num.size() - 1] == 0) {
            num.erase(num.begin(), num.begin() + num.size() - 1);
        }
        return ;
    }
    vector<int> num;
};

ostream &operator<<(ostream &out, BigInt &b) {
    for (int i = b.num.size() - 1; i >= 0; i--) {
        out << b.num[i];
    }
    return out;
}

int ans(BigInt &b) {
    int sum = 0;
    for (int i = b.num.size() - 1; i >= 0; i--) {
        sum += b.num[i];
    }
    return sum;
}

void solve(int n) {
    BigInt a(1);
    for (int i = 1; i <= n; i++) {
        a = a * i;
    }
    cout << ans(a) << endl;
}

int main() {
    int n;
    while (cin >> n) solve(n);
    return 0;
}
